package com.itheima.controller;

import com.itheima.domain.dto.Query;
import com.itheima.domain.vo.InfoVO;
import com.itheima.domain.vo.PageResult;
import com.itheima.service.InfoService;
import com.itheima.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;
import java.util.List;

@RestController
@Api(tags = "招聘信息相关的接口")
@RequestMapping("/info")
@Slf4j
public class InfoController {
    @Autowired
    private InfoService infoService;
    @GetMapping("")
    @ApiOperation("获取查询的招聘信息")
//    @Cacheable(value = "result",key = "#query")
    public Result<PageResult> query(Query query){
        log.info("query:{}",query);
        List<InfoVO> list=infoService.query(query);
        PageResult result = new PageResult(query.getPageNum(), list);
        return Result.success(result);
    }
}
